# Compiler settings C -> [gcc,icc] CPP -> [icpc,g++]
#set(CMAKE_C_COMPILER gcc)
#set(CMAKE_CXX_COMPILER g++)
#set(CMAKE_C_COMPILER mpicc)
#set(CMAKE_CXX_COMPILER mpic++)

# Compiler flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64 -Wextra")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -std=c++11 -Wextra")
#set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m64 -Wextra -ldl -liomp5 -lpthread -lOpenCL")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m64 -Wextra -ldl -fopenmp -lpthread -lOpenCL")

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
  # Debug only
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g3 -ggdb3")
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -g3 -ggdb3")
  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -O0 -g3 -ggdb3")

  # Address Sanitizer
  #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer -O0 -g3 -ggdb3")
  #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -O0 -g3 -ggdb3")
  #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address -O0 -g3 -ggdb3")
endif()

# MPI settings [mpi,nompi]
#set(MODFEM_MPI nompi)
# Acceleration settings [none,opencl,cuda]
#set(MODFEM_ACCEL none)

# Choose TRUE to buid static libraries (archives) and
# statically linked executables (slower); FALSE otherwise (faster)
set(MODFEM_USE_STATIC TRUE)

# Choose solver library used by executables
# Valid options are:
# - sil_pardiso
# - sil_krylow_bliter
# - sil_lapack
# Note: For sid_pardiso option MODFEM_USE_MKL must be set to TRUE
# Note: Due to cyclic dependency in sid_krylow_bliter MODFEM_USE_STATIC
# 	must be set to TRUE for that solver
set(MODFEM_ITER_SOLVER_MODULE sil_krylow_bliter)
set(MODFEM_DIRECT_SOLVER_MODULE sil_pardiso)

# Set to MKL, ACML or GENERIC
set(MODFEM_BLASLAPACK MKL)

#----------------------------------------------#
#   EXTERNAL LIBRARIES CONFIGURATION SECTION   #
#----------------------------------------------#

#----------------------
# MKL paths and names
# (only relevent if MODFEM_USE_MKL set to TRUE)
#
# Paths to look for MKL include file
# (you can provide more then one - whitespace separated)
set(MKL_INCLUDE_DIRS /usr/local/intel/mkl/include /usr/local/intel/mkl)
# Paths to look for MKL library files (you can provide more then one) and Intel Compiler library files (provide two paths)
#set(MKL_LIBRARY_DIRS /usr/local/intel/mkl/lib/ia32 /usr/local/intel/lib/ia32) # 32-bit system
set(MKL_LIBRARY_DIRS /usr/local/intel/mkl/lib/intel64 /usr/local/intel/lib/intel64) # 64-bit system

# MKL library names (no extension) -
# - consult: http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/
# 32-bit system
#set(MKL_INTEL_LIB_NAME mkl_intel)  #never use 'lib' prefix
#set(MKL_LAPACK_LIB_NAME mkl_lapack95) #usually not needed  #never use 'lib' prefix
#set(MKL_SOLVER_LIB_NAME mkl_solver)  #never use 'lib' prefix
#set(MKL_IOMP5_LIB_NAME iomp5 libiomp5md)  #never use 'lib' prefix
#set(MKL_THREAD_LIB_NAME mkl_intel_thread) #never use 'lib' prefix
#set(MKL_CORE_LIB_NAME mkl_core) #never use 'lib' prefix
# 64-bit system
set(MKL_INTEL_LIB_NAME mkl_intel_lp64)  #never use 'lib' prefix
set(MKL_LAPACK_LIB_NAME mkl_lapack95_lp64) #usually not needed  #never use 'lib' prefix
set(MKL_SOLVER_LIB_NAME mkl_solver_lp64)  #never use 'lib' prefix
set(MKL_IOMP5_LIB_NAME iomp5 libiomp5md)  #never use 'lib' prefix
set(MKL_THREAD_LIB_NAME mkl_gnu_thread) #never use 'lib' prefix
set(MKL_CORE_LIB_NAME mkl_core) #never use 'lib' prefix

#----------------------
# Blas and Lapack paths and names
# (only relevant if MODFEM_USE_MKL set to FALSE)
# (when MKL in use blas/lapack from MKL will be used)
#
# Paths to look for Blas,Lapack libraries
# (usually can be left empty)
set(LAPACK_DIRS)
set(BLAS_DIRS)
# Blas,Lapack library names (no extension)
set(BLAS_LIB_NAME blas) #never use 'lib' prefix
set(LAPACK_LIB_NAME lapack) #never use 'lib' prefix

#----------------------
# Libconfig paths and names
# (only important when building targets that use Libconfig)
set(LIBCONFIG_INCLUDE_DIRS /usr/include)
set(LIBCONFIG_LIBRARY_DIRS /usr/lib64 /usr/local/lib/)
set(LIBCONFIG_LIB_NAME config) #never use 'lib' prefix

#----------------------
# Boost paths and names
# (only important when building targets that use Boost)
set(BOOST_ROOT /usr/include/boost)
set(BOOST_INCLUDEDIR /usr/include/boost)
set(BOOST_LIBRARYDIR /usr/lib64)
set(BOOST_VER_NO "1.54.0") #put the whole version number in ""

#-----------------------
# FreeGLUT paths and names
set(GLUT_Xmu_LIBRARY /usr/lib64/libXmu.so.6)

#-------------------------
# OpenCL 
set(OPENCL_PATH /opt/cuda)
set(OPENCL_INCLUDE_DIRS ${OPENCL_PATH}/include)
set(OPENCL_LIBRARY_DIRS ${OPENCL_PATH}/lib64)
set(OPENCL_LIBRARIES ${OPENCL_PATH}/lib64/libOpenCL.so)
set(OPENCL_MACHINE "gpu")

# TODO: ACML, PARMETIS

# TODO: PARALLEL BUILD (MPI)

#-----------------------------------#
#   TARGETS CONFIGURATION SECTION   #
#-----------------------------------#

# Specify which exe targets should be created
# (usage: "make target_name", "make" will try to build all of them )
# use TRUE or FALSE. Do _not_ comment them out.

# HMT
set(CREATE_MOD_FEM_HMT_PRISM_STD FALSE)
set(CREATE_MOD_FEM_HMT_HYBRID_STD FALSE)
set(CREATE_MOD_FEM_HMT_PRISM2D_STD FALSE)
# CBS_LIB
set(CREATE_MOD_FEM_CBS_LIB FALSE)
# NS_SUPG_NEW
set(CREATE_MOD_FEM_NS_SUPG_NEW_PRISM_STD FALSE)
set(CREATE_MOD_FEM_NS_SUPG_NEW_PRISM_STD_TURBULENT FALSE)
set(CREATE_MOD_FEM_NS_SUPG_NEW_HYBRID_STD FALSE)
set(CREATE_MOD_FEM_NS_SUPG_NEW_HYBRID_STD_TURBULENT FALSE)
set(CREATE_MOD_FEM_NS_SUPG_NEW_PRISM2D_STD FALSE)
# NS_SUPG
set(CREATE_MOD_FEM_NS_SUPG_PRISM_STD FALSE)
set(CREATE_MOD_FEM_NS_SUPG_HYBRID_STD FALSE)
set(CREATE_MOD_FEM_NS_SUPG_PRISM2D_STD FALSE)
# NS_SUPG_HEAT
set(CREATE_MOD_FEM_NS_SUPG_HEAT_PRISM_STD FALSE)
set(CREATE_MOD_FEM_NS_SUPG_HEAT_HYBRID_STD FALSE)
set(CREATE_MOD_FEM_NS_SUPG_HEAT_PRISM2D_STD FALSE)
# CONV_DIFF
set(CREATE_MOD_FEM_CONV_DIFF_PRISM_STD TRUE)
set(CREATE_MOD_FEM_CONV_DIFF_PRISM_STD_QUAD TRUE)
set(CREATE_MOD_FEM_CONV_DIFF_HYBRID_STD FALSE)
set(CREATE_MOD_FEM_CONV_DIFF_HYBRID_STD_QUAD FALSE)
set(CREATE_MOD_FEM_CONV_DIFF_PRISM2D_STD FALSE)
set(CREATE_MOD_FEM_CONV_DIFF_PRISM2D_STD_QUAD FALSE)
set(CREATE_MOD_FEM_CONV_DIFF_PRISM_DG FALSE)
set(CREATE_MOD_FEM_CONV_DIFF_HYBRID_DG FALSE)
set(CREATE_MOD_FEM_CONV_DIFF_PRISM2D_DG FALSE)
# LAPLACE
set(CREATE_MOD_FEM_LAPLACE_PRISM_STD FALSE)
set(CREATE_MOD_FEM_LAPLACE_PRISM_STD_QUAD FALSE)
set(CREATE_MOD_FEM_LAPLACE_HYBRID_STD FALSE)
set(CREATE_MOD_FEM_LAPLACE_HYBRID_STD_QUAD FALSE)
set(CREATE_MOD_FEM_LAPLACE_PRISM2D_STD FALSE)
set(CREATE_MOD_FEM_LAPLACE_PRISM2D_STD_QUAD FALSE) 
set(CREATE_MOD_FEM_LAPLACE_PRISM_DG FALSE)
set(CREATE_MOD_FEM_LAPLACE_HYBRID_DG FALSE)
set(CREATE_MOD_FEM_LAPLACE_PRISM2D_DG FALSE)
# ELAST
set(CREATE_MOD_FEM_ELAST_PRISM_STD FALSE)
set(CREATE_MOD_FEM_ELAST_HYBRID_STD FALSE)
set(CREATE_MOD_FEM_ELAST_PRISM2D_STD FALSE)
# CBS
set(CREATE_MOD_FEM_CBS_PRISM FALSE)
set(CREATE_MOD_FEM_CBS_HYBRID FALSE)
# TURBULENT
set(CREATE_MOD_FEM_TURBULENT_LIB FALSE)
# MOD_FEM_VIWER
set(CREATE_MOD_FEM_VIEWER TRUE)
set(MOD_FEM_VIEWER_USE_AS_LIB TRUE)
set(MOD_FEM_VIEWER_GUI_LIN "WX")

